
CC = cl.exe
ASM = nasmw
LINK = link.exe

BINS = robot.exe
SRCS = $(wildcard *.cpp)
ASMS = $(wildcard *.asm)
OBJS = $(SRCS:.cpp=.obj)
OBJS += $(ASMS:.asm=.obj)
COMMOBJS = cQiju.obj five_client.obj five_machine.obj UDPSocket.obj
LIBS = lua/lua.lib wsock32.lib


OBJFLAGS = /I"../comm" /I"./" /c
LINKFLAGS = 

all: lua $(BINS)

.PHONY:lua
lua:
	cd lua && make

robot.exe:$(OBJS) $(COMMOBJS)
	$(LINK) $(LINKFLAGS) /out:"$@" $^ $(LIBS)

$(COMMOBJS):$(wildcard ../comm/*.cpp)
	$(CC) $(OBJFLAGS) $^
%.obj:%.cpp
	$(CC) $(OBJFLAGS) $<
%.obj:%.asm
	$(ASM) -o $@ -f win32 $<

clean:
	$(RM) -f *.exe *.obj *~